/*
 * Copyright 2010 Biz-e (info@biz-e.nl)
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package nl.biz_e.acl.client;

import java.util.List;

import nl.biz_e.acl.shared.model.Context;

import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;

/**
 * Defines all functionality for remote Context handling
 * 
 * @author Joost A. Bloemsma
 * 
 */
@RemoteServiceRelativePath("context")
public interface ContextService extends RemoteService {
	/**
	 * Persists the passed {@link Context}
	 * 
	 * @param ctx
	 */
	public void saveContext(Context ctx);
	
	/**
	 * Returns a {@link Context} based on the context ID
	 * 
	 * @param contextId
	 * @return instance of {@link Context}
	 */
	public Context getContext(String contextId);
	
	/**
	 * Returns the parent {@link Context} of the passed {@link Context}, if any.
	 * 
	 * @param ctx
	 * @return instance of {@link Context}
	 */
	public Context getParentContext(Context ctx);
	
	/**
	 * @return a list of all currently available contexts in the datastore
	 */
	public List<Context> getAllContexts();
	
}
